#include <stdio.h>
#include "esp_log.h"
#include "driver/sd_card.h"
#include "sd_test.h"

static const char *TAG = "main";

void app_main(void)
{
    esp_err_t ret;
    sdmmc_card_t *card;
    const char mount_point[] = MOUNT_POINT;
    
    // 初始化并挂载SD卡
    ret = sd_card_init_and_mount(mount_point, &card);
    if (ret != ESP_OK) {
        ESP_LOGE(TAG, "Failed to initialize and mount SD card");
        return;
    }
    
    // 运行SD卡测试
    ret = run_sd_card_test(card);
    if (ret != ESP_OK) {
        ESP_LOGE(TAG, "SD card test failed");
    }
    
    // 卸载SD卡
    sd_card_unmount(mount_point, card);
}